<template>
	<view>
		<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF"
			status-bar left-icon="left" left-text="返回"
			title="微信支付" @clickLeft="back" />
			
			
			<view><text class="uni-body">订单ID：{{orderId}}</text></view>
			<view><text class="uni-body">总金额：{{amount}}</text></view>
			<view><text class="uni-body">订单状态：{{orderStatus}}</text></view>
			
			<button type="primary" @click="orderquery">查询状态</button>
		
		<image style="width: 350px; height: 350px; background-color: #eeeeee;"
			:src="payBase64Image"></image>
	</view>
</template>

<script>
import payApi from '../../api/pay/wxpay.js'
export default {
	components: {},
	data() {
		return {
			orderId:'',
			amount:1,
			orderStatus:'未支付',
			payBase64Image:''
		}
	},
	methods:{
		back() {
			uni.navigateBack({
				delta: 1
			})
		},
		unifiedorder(){
			payApi.unifiedorder(this.orderId,this.amount).then(res=>{
				if(res.ok){
					this.payBase64Image = res.data.qrcode
				}
			})
		},
		orderquery(){
				
		}
	},		
	onLoad(options) {
		console.log(options.orderId,options.amount)
		this.orderId = options.orderId;
		this.amount = options.amount
		this.unifiedorder(options.orderId,options.amount);
	}
}
	
</script>

<style>
</style>